package system;


public class Metric {
	Long id;

	String vm;
	String app;
	String host;

	Long time;
	Long endtime;

	Double util_cpu;
	Double util_net;
	Double util_storage;

	Double if_cpu;
	Double if_net;
	Double if_storage;
	Double if_ram;

	Double response_average;
	Integer share_cpu;	

	Double VM_net_packTx;
	Double VM_net_packRx;
	Double VM_net_ByteTx;
	Double VM_net_ByteRx;

	Double VM_disk_opsRead;
	Double VM_disk_opsWrite;
	Double VM_disk_ByteRead;
	Double VM_disk_ByteWrite;

	Double used_mem;
	Double cached_mem;
	Double buffered_mem;
	Double free_mem;

	Double PM_CPU_active;
	Double PM_CPU_steal;
	Double PM_CPU_wait;

	int inputControllerWeight;
	double estimatedError;


	// when adding a metric, add it to the clone method as well
	
	public Metric(){}

	public Metric(Metric m){
		this.id = m.id;

		this.vm = m.vm;
		this.app = m.app;
		this.host = m.host;

		this.time = m.time;
		this.endtime = m.endtime;

		this.util_cpu = m.util_cpu;
		this.util_net = m.util_net;
		this.util_storage = m.util_storage;

		this.if_cpu = m.if_cpu;
		this.if_net = m.if_net;
		this.if_ram = m.if_ram;
		this.if_storage = m.if_storage;

		this.response_average = m.response_average;
		this.share_cpu = m.share_cpu;
	}

	public boolean equals(Object o){
		if(o instanceof Metric){
			Metric m = (Metric)o;

			if(this.getIf_cpu().equals(m.getIf_cpu()) && this.getIf_net().equals(m.getIf_net())
					&& this.getIf_ram().equals(m.getIf_ram())
					&& this.getVm().equals(m.getVm()) && this.response_average.equals(m.response_average))
				return true;
		}

		return false;
	}

	public void setEstimatedError(double error){
		this.estimatedError = error;
	}

	public double getEstimatedError(){
		return this.estimatedError;
	}

	public Double getResponse_average() {
		return response_average;
	}
	public void setResponse_average(Double responseAverage) {
		response_average = responseAverage;
	}
	public Integer getShare_cpu() {
		return share_cpu;
	}
	public void setShare_cpu(Integer shareCpu) {
		share_cpu = shareCpu;
	}	

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getVm() {
		return vm;
	}
	public void setVm(String vm) {
		this.vm = vm;
	}
	public String getApp() {
		return app;
	}
	public void setApp(String app) {
		this.app = app;
	}
	public String getHost() {
		return host;
	}
	public void setHost(String host) {
		this.host = host;
	}
	public Long getTime() {
		return time;
	}
	public void setTime(Long time) {
		this.time = time;
	}
	public Long getEndtime() {
		return endtime;
	}
	public void setEndtime(Long endtime) {
		this.endtime = endtime;
	}
	public Double getUtil_cpu() {
		return util_cpu;
	}
	public void setUtil_cpu(Double utilCpu) {
		util_cpu = utilCpu;
	}
	public Double getUtil_net() {
		return util_net;
	}
	public void setUtil_net(Double utilNet) {
		util_net = utilNet;
	}
	public Double getUtil_storage() {
		return util_storage;
	}
	public void setUtil_storage(Double utilStorage) {
		util_storage = utilStorage;
	}
	public Double getIf_cpu() {
		return if_cpu;
	}
	public void setIf_cpu(Double ifCpu) {
		if_cpu = ifCpu;
	}
	public Double getIf_ram() {
		return if_ram;
	}
	public void setIf_ram(Double ifRam) {
		if_ram = ifRam;
	}
	public Double getIf_net() {
		return if_net;
	}
	public void setIf_net(Double ifNet) {
		if_net = ifNet;
	}
	public Double getIf_storage() {
		return if_storage;
	}
	public void setIf_storage(Double ifStorage) {
		if_storage = ifStorage;
	}

	public void setVM_net_packTx(Double utilNet){
		VM_net_packTx=utilNet;
	}

	public void setVM_net_packRx(Double utilNet){
		VM_net_packRx=utilNet;
	}

	public void setVM_net_ByteTx(Double utilNet){
		VM_net_ByteTx=utilNet;
	}

	public void setVM_net_ByteRx(Double utilNet){
		VM_net_ByteRx=utilNet;
	}

	public void setVM_disk_opsRead(Double utilDisk){
		VM_disk_opsRead=utilDisk;
	}

	public void setVM_disk_opsWrite(Double utilDisk){
		VM_disk_opsWrite=utilDisk;
	}

	public void setVM_disk_ByteRead(Double utilDisk){
		VM_disk_ByteRead=utilDisk;
	}

	public void setVM_disk_ByteWrite(Double utilDisk){
		VM_disk_ByteWrite=utilDisk;
	}

	public void setUsed_mem(Double usedMem){
		used_mem=usedMem;
	}

	public void setCached_mem(Double cachedMem){
		cached_mem=cachedMem;
	}

	public void setBuffered_mem(Double bufferedMem){
		buffered_mem=bufferedMem;
	}

	public void setFree_mem(Double freeMem){
		free_mem=freeMem;
	}
	public void setPMActiveCPU(Double CPU){
		PM_CPU_active=CPU;
		if_cpu=PM_CPU_active-util_cpu;
	}
	public void setPMStealCPU(Double CPU){
		PM_CPU_steal=CPU;
	}
	public void setPMWaitCPU(Double CPU){
		PM_CPU_wait=CPU;
	}

	public Double getVM_net_packTx(){
		return VM_net_packTx;
	}

	public Double getVM_net_packRx(){
		return VM_net_packRx;
	}

	public Double getVM_net_ByteTx(){
		return VM_net_ByteTx;
	}

	public Double getVM_net_ByteRx(){
		return VM_net_ByteRx;
	}

	public Double getVM_disk_opsRead(){
		return VM_disk_opsRead;
	}

	public Double getVM_disk_opsWrite(){
		return VM_disk_opsWrite;
	}

	public Double getVM_disk_ByteRead(){
		return VM_disk_ByteRead;
	}

	public Double getVM_disk_ByteWrite(){
		return VM_disk_ByteWrite;
	}	

	public Double getUsed_mem(){
		return used_mem;
	}	

	public Double getCached_mem(){
		return cached_mem;
	}	

	public Double getBuffered_mem(){
		return buffered_mem;
	}

	public Double getFree_mem(){
		return free_mem;
	}
	public Double getPMActiveCPU(){
		return PM_CPU_active;
	}
	public Double getPMStealCPU(){
		return PM_CPU_steal;
	}
	public Double getPMWaitCPU(){
		return PM_CPU_wait;
	}

	public String toString(){
		return "\t"+this.if_cpu+"\t"+this.if_net+"\t"+this.if_storage+"\t"+this.util_cpu+"\t"+this.util_net+"\t"+this.util_storage+"\t"+this.if_ram+"\t"+this.share_cpu+"\t"+this.response_average;
	}

	public void setInputControllerWeight(int weight){
		this.inputControllerWeight=weight;
	}

	public int getInputControllerWeight(){
		return this.inputControllerWeight;
	}

	public Metric clone(){
		Metric clone=new Metric();

		clone.setId(this.getId());
		clone.setVm(this.getVm());
		clone.setApp(this.getApp());
		clone.setTime(this.getTime());
		clone.setEndtime(this.getEndtime());
		clone.setUtil_cpu(this.getUtil_cpu());
		clone.setUtil_net(this.getUtil_net());
		clone.setUtil_storage(this.getUtil_storage());
		clone.setIf_cpu(this.getIf_cpu());
		clone.setIf_net(this.getIf_net());
		clone.setIf_storage(this.getIf_storage());
		clone.setIf_ram(this.getIf_ram());
		clone.setResponse_average(this.getResponse_average());
		clone.setShare_cpu(this.getShare_cpu());
		clone.setVM_net_ByteRx(this.getVM_net_ByteRx());
		clone.setVM_net_ByteTx(this.getVM_net_ByteTx());
		clone.setVM_net_packRx(this.getVM_net_packRx());
		clone.setVM_net_packTx(this.getVM_net_packTx());
		clone.setVM_disk_opsRead(this.getVM_disk_opsRead());
		clone.setVM_disk_opsWrite(this.getVM_disk_opsWrite());
		clone.setVM_disk_ByteRead(this.getVM_disk_ByteRead());
		clone.setVM_disk_ByteWrite(this.getVM_disk_ByteWrite());
		clone.setUsed_mem(this.getUsed_mem());
		clone.setCached_mem(this.getCached_mem());
		clone.setBuffered_mem(this.getBuffered_mem());
		clone.setFree_mem(this.getFree_mem());
		clone.setPMActiveCPU(this.getPMActiveCPU());
		clone.setPMStealCPU(this.getPMStealCPU());
		clone.setPMWaitCPU(this.getPMWaitCPU());
		clone.setInputControllerWeight(this.getInputControllerWeight());
		clone.setEstimatedError(this.getEstimatedError());
		clone.setShare_cpu(this.getShare_cpu());


		return clone;
	}

}
